<?php
class VolController extends BaseController
{

	public function actionIndex(){
		
		$pre_count = 10;
		$p = empty($_GET['p']) ? 1 : (int)$_GET['p'];
		
		$re = obj('Vol')->select('','','id desc',array($p,$pre_count));
		
		
		$this->vols = $re;
		$this->display('vol_index.tpl');
	}
	
	public function actionDetail(){
		
		$id = (int) $_GET['id'];
		$vol = obj('Vol')->find(array('id'=>$id),'');
		if(empty($vol)) {header('location:'.URL);}
		
//TODO:标签转换  查题  查评论
		$this->tags = preg_split('#,|，| | #',$vol['tags']);
		$this->tis = obj('Ti')->ti_by_ids($vol['tis']);
		$this->vol = $vol;
		$this->display('vol_detail.tpl');
	}
}